#ifndef _SELECTION_SET_H_
#define _SELECTION_SET_H_

#include <osg/Referenced>
#include <osg/observer_ptr>
#include <osg/Node>
#include <set>

class SelectionSet : public osg::Referenced
{
public:
	SelectionSet();

	void add(osg::Node* pNode);
	void remove(osg::Node* pNode);
	void clear() { m_Selection.clear(); }

	bool containsNode(osg::Node* pNode) const;
	int getCount() const { return m_Selection.size(); }
	osg::Node* getNode(unsigned i) const { return m_Selection[i].get(); }
	osg::Node* getFirstNode() const { return getCount() > 0 ? getNode(0) : NULL; }

private:
        typedef std::vector< osg::observer_ptr<osg::Node> > NodeSet;
	NodeSet m_Selection;

private:
	void prune();
};

#endif
